package com.youth.userservice.mapper;

import com.youth.userservice.entity.UcenterMember;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.youth.userservice.entity.vo.RegisterVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

/**
 * <p>
 * 会员表 Mapper 接口
 * </p>
 *
 * @author huangqicai,CM
 * @since 2023-5-27
 */
@Mapper
public interface UcenterMemberMapper extends BaseMapper<UcenterMember> {

    @Update(" update ucenter_member set open_money=open_money-#{money} where id=#{userId} and open_money>=#{money}")
    /*根据用户id和金额去扣减金额-huang-远程*/
    boolean subtractMoney(@Param(value = "userId") String userId,@Param(value = "money") String money);

    @Update("update ucenter_member set is_disabled = #{type} where id = #{userId}")
    boolean disableStudent(@Param(value = "userId") String userId,@Param(value = "type") int type);

    /*更新用户信息*/
    void updateUserInfo(RegisterVo registerVo);
}
